<!DOCTYPE html>
<html lang="en">
<head>
    <meta charset="UTF-8">
    <title>增加供应商信息</title>
    <link rel="stylesheet" href="/css/font.css">
    <link rel="stylesheet" href="/css/xadmin.css">
    <script type="text/javascript" src="/js/jquery-3.2.1.min.js"></script>
    <script src="/lib/layui/layui.js" charset="utf-8"></script>
    <script type="text/javascript" src="/js/xadmin.js"></script>
</head>
<body>
<div class="x-body" style="position: absolute;left:30%;top:20%">
    <form class="layui-form">
        <div class="layui-form-item">
            <label class="layui-form-label">
                <span class="x-red">*</span>供应商名
            </label>
            <div class="layui-input-inline">
                <input type="text" id="name" name="name" required="" lay-verify="required"
                       autocomplete="off" class="layui-input">
            </div>
        </div>

        <div class="layui-form-item">
            <label class="layui-form-label">
                <span class="x-red">*</span>法人代表
            </label>
            <div class="layui-input-inline">
                <input type="text" id="legal_person" name="legal_person" required="" lay-verify="required"
                       autocomplete="off" class="layui-input">
            </div>
        </div>

        <div class="layui-form-item">
            <label class="layui-form-label">
                <span class="x-red">*</span>采购员编号
            </label>
            <div class="layui-input-inline">
                <input type="text" id="buyer" name="buyer" required="" lay-verify="required"
                       autocomplete="off" class="layui-input">
                </select>
            </div>
        </div>

        <div class="layui-form-item">
            <label class="layui-form-label">
                <span class="x-red">*</span>合作时间
            </label>
            <div class="layui-input-inline">
                <input type="text" id="begin_cooperation" name="begin_cooperation" required="" lay-verify="required"
                       autocomplete="off" class="layui-input">
                </select>
            </div>
        </div>

        <div class="layui-form-item">
            <label class="layui-form-label">
                <span class="x-red">*</span>合作年限
            </label>
            <div class="layui-input-inline">
                <input type="text" id="cooperation_years" name="cooperation_years" disabled required="" lay-verify="required"
                       autocomplete="off" class="layui-input" value="0">
            </div>
        </div>

        <div class="layui-form-item">
            <label class="layui-form-label">
                <span class="x-red">*</span>联系电话
            </label>
            <div class="layui-input-inline">
                <input type="text" id="tel" name="tel" required="" lay-verify="required"
                       autocomplete="off" class="layui-input">
            </div>
        </div>

        <div class="layui-form-item">
            <label class="layui-form-label">
            </label>
            <button  class="layui-btn" lay-filter="add" lay-submit="">
                保存
            </button>
        </div>
        <span id="info" style="color: red"></span>
    </form>
</div>
<script>

    layui.use(['form','layer'], function(){
        $ = layui.jquery;
        var form = layui.form
            ,layer = layui.layer;

        //保存
        form.on('submit(add)', function(data){
            $.ajax({
                url:"/supplier/addSup",
                type:"post",
                data:data.field,
                dataType:"json", //返回的数据类型
                success:function (data) {
                    $("#info").text(data.info);
                }
            })
            return false;
        });


    });
</script>
<script>var _hmt = _hmt || []; (function() {
    var hm = document.createElement("script");
    hm.src = "https://hm.baidu.com/hm.js?b393d153aeb26b46e9431fabaf0f6190";
    var s = document.getElementsByTagName("script")[0];
    s.parentNode.insertBefore(hm, s);
})();</script>
</body>

</html>